package com.dhcc.sds.standard.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.dhcc.core.framework.util.CommonUtil;
import com.dhcc.sds.standard.entity.SdsStandDicEntity;
import com.dhcc.sds.standard.entity.SdsStandDicsubEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.dhcc.core.framework.base.service.impl.BaseServiceImpl;
import com.dhcc.sds.standard.dao.SdsStandBaseMatchMapper;
import com.dhcc.sds.standard.service.ISdsStandBaseMatchService;
import com.dhcc.sds.standard.entity.SdsStandBaseMatchEntity;

/**
 * 标准化_基础信息关键字表数据服务层接口
 * 
 * @ClassName: SdsStandBaseMatchServiceImpl
 * @Description: TODO
 * @author sunyingjie
 * @date 2021-03-22 10:09:56
 */
@Service("sdsStandBaseMatchService")
public class SdsStandBaseMatchServiceImpl extends BaseServiceImpl<SdsStandBaseMatchMapper, SdsStandBaseMatchEntity> implements ISdsStandBaseMatchService {

	@Autowired
	private SdsStandBaseMatchMapper standBaseMatchMapper;

	@Override
	public List<SdsStandBaseMatchEntity> page(Page<SdsStandBaseMatchEntity> page, Map<String, Object> map) {
		return this.baseMapper.page(page, map);
	}
	@Override
	public List<SdsStandBaseMatchEntity> list(Map<String, Object> map) {
		return this.baseMapper.list(map);
	}

	@Override
	public String getDicKeyByDicSubId(Long dicSubId) {

		SdsStandBaseMatchEntity standBaseMatchEntity = new SdsStandBaseMatchEntity();
		standBaseMatchEntity.setDicsubId(dicSubId);
		SdsStandBaseMatchEntity standBaseMatchEntity1 = standBaseMatchMapper.selectOne(standBaseMatchEntity);
		if (CommonUtil.isOneEmpty(standBaseMatchEntity1)){
			return "1";
		}else {
			return standBaseMatchEntity1.getResultKeys();
		}

	}

	@Override
	public String getDicFilterByDicSubId(Long dicSubId) {
		SdsStandBaseMatchEntity standBaseMatchEntity = new SdsStandBaseMatchEntity();
		standBaseMatchEntity.setDicsubId(dicSubId);
		SdsStandBaseMatchEntity standBaseMatchEntity1 = standBaseMatchMapper.selectOne(standBaseMatchEntity);
		if (CommonUtil.isOneEmpty(standBaseMatchEntity1)){
			return "";
		}else {
			return standBaseMatchEntity1.getResultFilter();
		}
	}

	@Override
	public List<Long> selectMatchDicsub() {
		return this.baseMapper.selectMatchDicsub();
	}


}